﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
using com.dz.common;
using com.dz.components;

namespace com.dz.web.User
{
    public partial class ContactUS : BasePage
    {
        const string c_top_template = "<DIV class=bd><DIV class=toplist><DIV class=list12><table cellpadding=\"0\" cellspacing=\"0\">{0}</table></div></div></div>";
        const string c_top_vip_click_template = "<tr><td class=\"book\"><A href=\"/{0}.aspx\" target=_blank>{1}</A></td><td class=\"click\">{2}</td></tr>";

        BookManager m_book_mgr = new BookManager();


        protected void Page_Load(object sender, EventArgs e)
        {

            if (Token == null)
                RedirectErrorPage();
            else
            {
                if (Token != null)
                {
                    lblUserName.InnerText = Token.NickName;
                }
                BindData();
             
            }
        }


        private void BindData()
        {
            try
            {
                DataSet ds = m_book_mgr.GetClickBookList(12);
                StringBuilder sb = new StringBuilder();

                if (ds != null && ds.Tables.Count > 0)
                {
                    for (int index = 0; index < ds.Tables[0].Rows.Count; index++)
                    {
                        sb.AppendFormat(c_top_vip_click_template, ds.Tables[0].Rows[index]["bookId"], SystemUtil.GetGBString(ds.Tables[0].Rows[index]["bookName"].ToString(), 14), ds.Tables[0].Rows[index]["click"]);
                    }
                    lblVipClick.Text = string.Format(c_top_template, sb.ToString());

                }
            }
            catch (Exception ex)
            {
                LogHelper.Error("绑定错误页面数据列表失败" + ex.ToString());
            }
        }
    }
}
